<html>
<head><meta charset="utf-8"><title>lsp got out of sync · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html">lsp got out of sync</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205844433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205844433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205844433">(Aug 03 2020 at 20:36)</a>:</h4>
<p>I somehow managed to get r-a out of sync with the editor. The editor has</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#[cfg_pub(</span>
<span class="cp">    if #[cfg(SET_CFG)]</span><span class="w"> </span><span class="k">pub</span><span class="w"></span>
<span class="w">    </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="cp">#[cfg(not(SET_CFG))]</span><span class="w"> </span><span class="k">pub</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"></span>
<span class="p">)]</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;do something&quot;</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>and save-on-format is giving me</p>
<div class="codehilite"><pre><span></span><code>[Error - 4:33:45 PM] Request textDocument/formatting failed.
  Message: rustfmt exited with:
                           Status: exit code: 101
                           stdout:
  Code: -32900
error: unterminated double quote string
 --&gt; &lt;stdin&gt;:5:46
  |
5 |       else if #[cfg(not(SET_CFG))] pub(self() g&quot;);
  |  ______________________________________________^
6 | | }
  | |__^

[Error - 4:34:05 PM] Request textDocument/formatting failed.
  Message: rustfmt exited with:
                           Status: exit code: 101
                           stdout:
  Code: -32900
</code></pre></div>



<a name="205844621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205844621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205844621">(Aug 03 2020 at 20:38)</a>:</h4>
<p>I told the language server to reload and I got the "Reloading rust-analyzer..." notification but r-a just hung from there. Restarted vscode and everything seems to be working again.</p>



<a name="205844648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205844648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205844648">(Aug 03 2020 at 20:38)</a>:</h4>
<p>Obviously I don't really have a repro case <span aria-label="sweat" class="emoji emoji-1f613" role="img" title="sweat">:sweat:</span></p>



<a name="205844668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205844668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205844668">(Aug 03 2020 at 20:38)</a>:</h4>
<p>Here's a dump of the "See output": <a href="https://gist.github.com/CAD97/b11de332558d66c57e350bf296821a3b">https://gist.github.com/CAD97/b11de332558d66c57e350bf296821a3b</a></p>



<a name="205844878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205844878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205844878">(Aug 03 2020 at 20:40)</a>:</h4>
<p>What I did when this happened:</p>
<p>I had</p>
<div class="codehilite"><pre><span></span><code><span class="cp">#[cfg_pub(</span>
<span class="cp">    if #[cfg(SET_CFG)]</span><span class="w"> </span><span class="k">pub</span><span class="w"></span>
<span class="w">    </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="cp">#[cfg(not(SET_CFG))]</span><span class="w"> </span><span class="k">pub</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"></span>
<span class="p">)]</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">example</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;do something&quot;</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>

<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>I then used "move line" to pull the <code>println</code> into <code>main</code> and then to move the attribute down to main, and then deleted <code>fn example</code>.</p>



<a name="205844944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205844944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205844944">(Aug 03 2020 at 20:41)</a>:</h4>
<p>(Also, if it has any relevance; this is an example in a workspace implementing <code>#[cfg_pub]</code> using watt.)</p>



<a name="205847851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205847851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205847851">(Aug 03 2020 at 21:10)</a>:</h4>
<p>Those panics are probably not good. Can you rebuild with debug symbols?</p>



<a name="205870338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205870338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205870338">(Aug 04 2020 at 03:30)</a>:</h4>
<p>Well I just managed to reproduce the issue, so I'll see if I can</p>



<a name="205870949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205870949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205870949">(Aug 04 2020 at 03:47)</a>:</h4>
<p>I've been switching back and forth between a source installed version and the extension managed version</p>



<a name="205870953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205870953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205870953">(Aug 04 2020 at 03:47)</a>:</h4>
<p>I've not been able to get the one installed from source to fault</p>



<a name="205871002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871002">(Aug 04 2020 at 03:48)</a>:</h4>
<p>But I did get what looks to be a new fault (on the extension managed server): <a href="https://gist.github.com/CAD97/e92157c96679340c2662c14c3dda89f9">https://gist.github.com/CAD97/e92157c96679340c2662c14c3dda89f9</a></p>



<a name="205871028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871028">(Aug 04 2020 at 03:49)</a>:</h4>
<p>Yeah the client/server state is definitely getting trashed somewhere</p>



<a name="205871036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871036">(Aug 04 2020 at 03:49)</a>:</h4>
<p>I have a consistentish break on the managed install, let's see if it translates to a source installed one...</p>



<a name="205871121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871121">(Aug 04 2020 at 03:51)</a>:</h4>
<p>ooo progress</p>



<a name="205871183"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871183" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871183">(Aug 04 2020 at 03:53)</a>:</h4>
<p>I can get a fault with the extension version 0.2.264 but not when it's installed from source</p>



<a name="205871475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871475">(Aug 04 2020 at 04:00)</a>:</h4>
<p>I think it still uses the rust-analyzer binary from PATH first? I honestly don't know enough</p>



<a name="205871531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871531">(Aug 04 2020 at 04:02)</a>:</h4>
<p>Quick example of repro: <a href="https://imgur.com/72UJjjK">https://imgur.com/72UJjjK</a></p>



<a name="205871537"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871537" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871537">(Aug 04 2020 at 04:03)</a>:</h4>
<p>Starting from <code>xtask install</code> and just switching to the published version of the extension</p>



<a name="205871543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871543">(Aug 04 2020 at 04:03)</a>:</h4>
<p>Repo I'm doing this in: <a href="https://github.com/CAD97/cfg-pub/">https://github.com/CAD97/cfg-pub/</a></p>



<a name="205871739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871739">(Aug 04 2020 at 04:08)</a>:</h4>
<p>(deleted)</p>



<a name="205871902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871902">(Aug 04 2020 at 04:13)</a>:</h4>
<p>Ah, so the installed version was still using the managed server binary rather than the one got from <code>xtask install</code>...</p>



<a name="205871955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205871955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205871955">(Aug 04 2020 at 04:14)</a>:</h4>
<p>I think whatever issue I am seeing was fixed by <a href="https://github.com/rust-analyzer/rust-analyzer/pull/5659">#5659</a></p>



<a name="205872071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205872071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205872071">(Aug 04 2020 at 04:18)</a>:</h4>
<p>Yep, checking out before that merge makes the issue return</p>



<a name="205872105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205872105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christopher Durham <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205872105">(Aug 04 2020 at 04:19)</a>:</h4>
<p>output: <a href="https://gist.github.com/CAD97/048b56f77aa2505dd3a20fc3d762b007">https://gist.github.com/CAD97/048b56f77aa2505dd3a20fc3d762b007</a></p>



<a name="205875099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205875099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205875099">(Aug 04 2020 at 05:44)</a>:</h4>
<p>Sigh. If matklad starts selling "I broke rust-analyzer" T-shirts, I'll buy one (and wear it in shame).</p>



<a name="205875132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205875132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205875132">(Aug 04 2020 at 05:45)</a>:</h4>
<p>I tried really hard, but never saw this happen. Curiously, every report is from Windows.</p>



<a name="205886723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/lsp%20got%20out%20of%20sync/near/205886723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/lsp.20got.20out.20of.20sync.html#205886723">(Aug 04 2020 at 09:18)</a>:</h4>
<p>I've kicked release</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>